package edu.tsinghua.ddb.sandbox;

import java.sql.SQLException;

import com.sun.rowset.CachedRowSetImpl;

import edu.tsinghua.ddb.main.console.PresentResult;
import edu.tsinghua.ddb.util.Conf;

public class loaddata {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		String str = "load data infile 'c:/imp.txt' into table ddbd.tablename lines terminated by '\r\n';";
		CachedRowSetImpl crs;
		try {
			Class.forName("org.gjt.mm.mysql.Driver").newInstance();
			crs = new CachedRowSetImpl();
			crs.setUsername("root");
			crs.setPassword("kuaisan");
			String url = Conf.get("conn");
			// url+="d";
			crs.setUrl(url);

			crs.setCommand(str);
			crs.execute();
			PresentResult.printResultSet(crs);
		} catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
		}
	}

}
